//
//  main.swift
//  learnSwitf
//
//  Created by Open on 3/19/15.
//  Copyright (c) 2015 open-groupe. All rights reserved.
//

import Foundation

println("Hello, World!")


func test()
{

    
    let mailPattern =
    "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$"
    let matcher = RegexHelper(mailPattern)
    let maybeMailAddress = "onev onevcat.com"
    
    if matcher.match(maybeMailAddress) {
        println("有效的邮箱地址")
    }else {
         println("无效的邮箱地址")
    }
    
    if "onev@onevcat.com" =~
        "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$" {
            println("有效的邮箱地址")
    }
}

func test2()
{
   println("test2")
    if "onev@onevcat.com" =~
        "^([a-z0-9_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$" {
            println("有效的邮箱地址")
    }else {
        println("无效的邮箱地址")
    }
}

// test Currying
func testCurrying()
{
    let addToFour = addTwoNumber(4)
    let result = addToFour(num: 10)
    println("\(result)")
}
//testCurrying()
func testCurrying2 ()
{
    let tv = MyViewController()
    tv.viewDidLoad()
}

testCurrying2()

 